package com.stxx.stiot2.controller;

import com.stxx.framwork.domain.R;
import com.stxx.framwork.domain.model.Option;
import com.stxx.framwork.domain.model.PageQuery;
import com.stxx.framwork.domain.model.PageResult;
import com.stxx.stiot2.domain.SysConfig;
import com.stxx.stiot2.service.SysConfigService;
import org.noear.solon.annotation.*;

import java.sql.SQLException;
import java.util.List;

@Controller
@Mapping("/sysconfig")
public class SysConfigController {

    @Inject
    SysConfigService baseService;

    @Get
    @Mapping("/list")
    public R<List<SysConfig>> list(SysConfig bo) throws SQLException {
        List<SysConfig> r = baseService.list(bo);
        return R.ok(r);
    }


    @Post
    @Mapping("")
    public R<Object> add(@Body SysConfig bo) throws SQLException {
        baseService.insert(bo);
        return R.ok("数据保存成功");
    }

    @Put
    @Mapping("")
    public R<Object> edit(@Body SysConfig bo) throws SQLException {
        baseService.update(bo);
        return R.ok("数据保存成功");
    }

    @Delete
    @Mapping("/{ids}")
    public R<Object> remove(@Path String[] ids) throws SQLException {
        baseService.deleteByIds(ids);
        return R.ok("数据删除成功");
    }
}
